package com.itheima.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet("/sand")
public class SandServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("欢迎来到比奇堡沙滩，我是海绵宝宝 欢迎你们");
        System.out.println("到达了沙滩，我拿出我的合法物品清单");

        //我们要从安全的物品清单中拿出数据
        //
        ArrayList<String> list = (ArrayList<String>)request.getAttribute("list");

        //遍历
        System.out.println("安全的物品清单有:"+list);

        response.getWriter().write("带到沙滩上的物品有:"+list);
    }
}
